package com.leo.foodmaster.admin.customer.service.impl;

import org.springframework.stereotype.Service;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.leo.foodmaster.admin.customer.dto.CustomerDeliveryTeamDTO;
import com.leo.foodmaster.admin.customer.entity.CustomerDeliveryTeamEntity;
import com.leo.foodmaster.admin.customer.mapper.CustomerDeliveryTeamMapper;
import com.leo.foodmaster.admin.customer.service.ICustomerDeliveryTeamService;
import lombok.AllArgsConstructor;

/**
 * 客户配送小组
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2021-11-20
 */
@Service
@AllArgsConstructor
public class ICustomerDeliveryTeamServiceImpl extends ServiceImpl<CustomerDeliveryTeamMapper, CustomerDeliveryTeamEntity> implements ICustomerDeliveryTeamService {

	private final CustomerDeliveryTeamMapper customerDeliveryTeamMapper;
	@Override
	public IPage<CustomerDeliveryTeamEntity> page(IPage<CustomerDeliveryTeamDTO> page, CustomerDeliveryTeamDTO customerDeliveryTeamdto) {
			CustomerDeliveryTeamEntity customerDeliveryTeamentity=new CustomerDeliveryTeamEntity();
		BeanUtil.copyProperties(customerDeliveryTeamdto,customerDeliveryTeamentity);
		LambdaQueryWrapper<CustomerDeliveryTeamEntity> eq = Wrappers.lambdaQuery(customerDeliveryTeamentity);
		return customerDeliveryTeamMapper.selectPage(new Page<>(page.getCurrent(),page.getSize()), eq);
	}

	@Override
	public IPage<CustomerDeliveryTeamDTO> pageList(IPage<CustomerDeliveryTeamDTO> page,CustomerDeliveryTeamDTO customerDeliveryTeamDTO) {

		return customerDeliveryTeamMapper.pageList(page,customerDeliveryTeamDTO);
	}}
